package team.seekers.hula.user.userData.controller;


import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import team.seekers.hula.auth.service.MindUtils;
import team.seekers.hula.common.annotation.ApiResponseBody;
import team.seekers.hula.common.utils.JwtUtil;
import team.seekers.hula.user.user.service.UserService;
import team.seekers.hula.user.userData.entity.vo.UserDataInfoVO;
import team.seekers.hula.user.userData.service.UserDataService;

/**
 * @author hbc
 * @since 2021-02-15
 */
@Controller
@ApiResponseBody
@RequestMapping("/user/data")
public class UserDataController {

    @Autowired
    private UserService userService;
    @Autowired
    private UserDataService userDataService;

    @Autowired
    private JwtUtil jwtUtil;

    @GetMapping("/info")
    public UserDataInfoVO get(@RequestParam(required = false) String id) {
        if(StringUtils.isNotBlank(id)){
            return userDataService.getDataInfoVO(id);
        }else {
            return userDataService.getDataInfoVO(MindUtils.getUserId());
        }

    }


}

